package priv.dajie.tzzq.bot.model;

import java.util.ArrayList;
import java.util.HashMap;

public class SteamSellingItems extends ArrayList<SteamSellingItem> {
    private HashMap<String, SteamSellingItem> nameMap = null;
    private HashMap<String, SteamSellingItem> idMap = null;

    public synchronized HashMap<String, SteamSellingItem> getNameMap(){
        if(nameMap == null){
            nameMap = new HashMap<>();
            for(SteamSellingItem packItem : this){
                nameMap.put(packItem.getSteamName(), packItem);
            }
        }
        return nameMap;
    }

    public synchronized HashMap<String, SteamSellingItem> getIDMap(){
        if(idMap == null){
            idMap = new HashMap<>();
            for(SteamSellingItem steamSellingItem : this)
                idMap.put(steamSellingItem.getListingid(), steamSellingItem);
        }
        return idMap;
    }
}
